
def binarySearch(target, ar):

    low = 0;
    high = len(ar) - 1
    while low <= high:
        middle = ( low + high) / 2
        if target > ar[middle]:
            low = middle + 1
        elif target < ar[middle]:
            high = middle - 1
        else:
            return middle
    return False

ar = [11, 22, 33, 44, 55, 66, 77, 88, 99]
print binarySearch(22, ar)


